﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using System.Configuration.Provider;
using SCRUM.Core.BusinessObjects;
using System.Web.Security;

namespace SCRUM.Core.MembershipProviders
{
    /// <summary>
    /// Interface for all membership(,role,profile,...) providers
    /// </summary>
    public abstract class MembershipDataProvider : MembershipProvider
    {
		/// <summary>
		/// Creates the new user.
		/// </summary>
		/// <param name="username">The username.</param>
		/// <param name="password">The password.</param>
		/// <param name="email">The email.</param>
		/// <param name="passwordQuestion">The password question.</param>
		/// <param name="passwordAnswer">The password answer.</param>
		/// <param name="isApproved">if set to <c>true</c> [is approved].</param>
		/// <param name="providerUserKey">The provider user key.</param>
		/// <param name="fullName">The full name.</param>
		/// <param name="roleID">The role ID.</param>
		/// <param name="teamID">The team ID.</param>
		/// <param name="userSettingsID">The user settings ID.</param>
		/// <param name="status">The status.</param>
		/// <returns>Newly created user.</returns>
        public abstract User CreateNewUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, string fullName, int roleID, int teamID, int userSettingsID, out MembershipCreateStatus status);

		/// <summary>
		/// Creates the user.
		/// </summary>
		/// <param name="user">The user.</param>
		/// <returns>Newly created user.</returns>
        public abstract User CreateUser(User user);

        /// <summary>
        /// Updates information about a user in the data source.
        /// </summary>
        /// <param name="user">A <see cref="T:System.Web.Security.MembershipUser"/> object that represents the user to update and the updated information for the user.</param>
        public abstract void UpdateUser(User user);

		/// <summary>
		/// Gets the logged user.
		/// </summary>
		/// <returns>Logged user.</returns>
        public abstract User GetUser();
        public abstract bool LockUser(string username);

        /// <summary>
        /// Gets the users which can be assigned to the task.
        /// </summary>
        /// <param name="taskID">The task ID.</param>
        /// <returns></returns>
        public abstract IList<User> GetUsersExceptTaskUsers(int taskID);

        /// <summary>
        /// Gets the user by login.
        /// </summary>
        /// <param name="login">The login.</param>
        /// <returns></returns>
        //public abstract User GetUserByLogin(string login);

        /// <summary>
        /// Gets the user by ID.
        /// </summary>
        /// <param name="userID">The user ID.</param>
        /// <returns></returns>
        public abstract User GetUserByID(int userID);

        /// <summary>
        /// Determines whether the specified user with ID is admin.
        /// </summary>
        /// <param name="userID">The user ID.</param>
        /// <returns>
        /// 	<c>true</c> if the specified user ID is admin; otherwise, <c>false</c>.
        /// </returns>
        public abstract bool IsAdmin(int userID);

        /// <summary>
        /// Changes the password.
        /// </summary>
        /// <param name="login">The login.</param>
        /// <param name="oldPassword">The old password.</param>
        /// <param name="newPassword">The new password.</param>
        /// <param name="status">The status.</param>
        /// <returns></returns>
        public abstract bool ChangePassword(string login, string oldPassword, string newPassword, out string status);
        
        /// <summary>
        /// Resets user's the password by admin.
        /// </summary>
        /// <param name="userID">The user ID.</param>
        /// <param name="newPassword">The new password.</param>
        /// <returns></returns>
        public abstract bool ResetPasswordByAdmin(int userID, string newPassword);

        /// <summary>
        /// Gets the user profile ID.
        /// </summary>
        /// <param name="defaultRoleID">ID of profile User.</param>
        /// <returns></returns>
        public abstract int GetUserProfileID(int defaultRoleID);
    }

        
}
